from fastapi import Request, HTTPException
from common.response_model import UnifiedResponse


async def global_exception_handler(request: Request, exc: Exception):
    if isinstance(exc, HTTPException):
        return UnifiedResponse.error(code=exc.status_code, message=exc.detail)
    return UnifiedResponse.error(code=500, message="Internal Server Error")
